package com.mall.pay.constants;

/**
 *  ciggar
 * create-date: 2019/7/23-16:45
 * user-service统一错误码为  004
 */
public enum PayRetCode {
    // 系统公用
    SUCCESS                             ("000000", "成功"),

    PARAM_IS_NULL                       ("100000","必要參數為空"),

    SYSTEM_ERROR                        ("004099", "系统错误")

    ;
    private String code;
    private String message;

    PayRetCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * Getter method for property <tt>code</tt>.
     *
     * @return property value of code
     */
    public String getCode() {
        return code;
    }

    /**
     * Setter method for property <tt>code</tt>.
     *
     * @param code value to be assigned to property code
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * Getter method for property <tt>message</tt>.
     *
     * @return property value of message
     */
    public String getMessage() {
        return message;
    }

    /**
     * Setter method for property <tt>message</tt>.
     *
     * @param message value to be assigned to property message
     */
    public void setMessage(String message) {
        this.message = message;
    }

    public static String getMessage(String code) {
        for (PayRetCode s : PayRetCode.values()) {
            if (null == code)
                break;
            if (s.code.equals(code)) {
                return s.message;
            }
        }
        return null;
    }
}
